package com.woniuxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.mapper.GoodsAuditMapper;
import com.woniuxy.service.GoodsAuditService;
import com.work.framework.pojo.GoodsAuctionDTO;
import com.work.framework.pojo.ResultDTO;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author fengyao
 * @version 1.0
 * @date 2019/9/26 0026 上午 11:35
 */
@Service
//@EnableCaching
public class GoodsAuditServiceImpl implements GoodsAuditService {

    @Resource
    GoodsAuditMapper goodsAuditMapper;
    @Override
//    @Cacheable(value="goodsAudit",keyGenerator = "myKeyGenerator")
    public ResultDTO selectGoodsAuditList() {
        PageHelper.startPage(1,1);
        List<GoodsAuctionDTO> goodsAuctionDTOS = goodsAuditMapper.selectGoodsAuditList();
        PageInfo<GoodsAuctionDTO> pageInfo=new PageInfo<>(goodsAuctionDTOS);
        long total = pageInfo.getTotal();
        return new ResultDTO(0,"成功",goodsAuctionDTOS,total);
    }

    @Override
//    @Cacheable(value="goodsAudit",keyGenerator = "myKeyGenerator")
    public ResultDTO selectGoods() {
        PageHelper.startPage(1,1);
        List<GoodsAuctionDTO> goodsAuctionDTOS = goodsAuditMapper.selectGoods();
        PageInfo<GoodsAuctionDTO> pageInfo=new PageInfo<>(goodsAuctionDTOS);
        long total = pageInfo.getTotal();
        return new ResultDTO(0,"成功",goodsAuctionDTOS,total);
    }
}
